﻿<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
 Id="Workflow.ApproveReject"
 Location="CommandUI.Ribbon"
 RegistrationType="ContentType"
 RegistrationId="0x01"
 Rights="ApproveItems">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.Templates._children">
          <GroupTemplate Id="Ribbon.Templates.P3GroupInExistingTab">
            <Layout Title="P3GroupInExistingTabOneLarge">
              <Section Alignment="Top" Type="OneRow">
                <Row>
                  <ControlRef DisplayMode= "Large" TemplateAlias ="LargeButton" />
                </Row>
              </Section>
            </Layout>
          </GroupTemplate>
        </CommandUIDefinition>
          
        <CommandUIDefinition Location="Ribbon.ListItem.Scaling._children">
          <MaxSize Id ="P3.SharePoint.Ribbon.P3tools.BulkApproval.MaxSize"
                   GroupId="P3.SharePoint.Ribbon.P3tools.BulkApproval.Group"
                   Size="P3GroupInExistingTabOneLarge"/>
        </CommandUIDefinition>
         
        <CommandUIDefinition Location="Ribbon.ListItem.Groups._children">
          <Group Id ="P3.SharePoint.Ribbon.P3tools.BulkApproval.Group"
                 Sequence="85"
                 Description="P3 Tools Group"
                 Title="P3 Tools"
                 Template="Ribbon.Templates.P3GroupInExistingTab">
            <Controls Id ="P3.SharePoint.Ribbon.P3tools.BulkApproval.Controls">
              <Button Id="P3.SharePoint.Ribbon.P3tools.BulkApproval.Button"
                      Sequence="10"
                      LabelText="Bulk Approve/Reject"
                      Command="approveMultipleItems"
                      Image32by32="~site/Style Library/Images/bulkapprove32.png"
                      TemplateAlias="LargeButton"
                      />
            </Controls>
          </Group>
        </CommandUIDefinition>

        <CommandUIDefinition Location="Ribbon.Documents.Scaling._children">
          <MaxSize Id ="P3.SharePoint.Ribbon.Document.P3tools.MaxSize"
                   GroupId="P3.SharePoint.Ribbon.Document.P3tools.Group"
                   Size="P3GroupInExistingTabOneLarge"/>
        </CommandUIDefinition>

        <CommandUIDefinition Location="Ribbon.Documents.Groups._children">
          <Group Id ="P3.SharePoint.Ribbon.Document.P3tools.Group"
                 Sequence="85"
                 Description="P3 Tools Group"
                 Title="P3 Tools"
                 Template="Ribbon.Templates.P3GroupInExistingTab">
            <Controls Id ="P3.SharePoint.Ribbon.Document..P3tools.Controls">
              <Button Id="P3.SharePoint.Ribbon.Document.P3tools.Button"
                      Sequence="10"
                      LabelText="Bulk Approve/Reject"
                      Command="approveMultipleItems"
                      Image32by32="~site/Style Library/Images/bulkapprove32.png"
                      TemplateAlias="LargeButton"/>
            </Controls>
          </Group>
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
          Command="approveMultipleItems"
          EnabledScript="javascript:enableApprovalAll_BulkApproval();"
          CommandAction="javascript:showApproveAll_BulkApproval('{SiteUrl}'); "/>
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>

  <CustomAction
   Location="ScriptLink"
   ScriptSrc ="~site/Style Library/P3/ApproveReject.js"/>
</Elements>
